package com.fm.app03.Activity;

import androidx.appcompat.app.AppCompatActivity;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import com.fm.app03.R;

public class StarDetailsActivity extends AppCompatActivity {

    @SuppressLint("SetTextI18n")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_star_details);


        // 获取传递过来的Intent对象
        Intent intent = getIntent();

        // 从Intent对象中获取姓名和日期数据
        String name = intent.getStringExtra("name");
        int year = intent.getIntExtra("year", 0);
        int month = intent.getIntExtra("month", 0);
        int day = intent.getIntExtra("day", 0);

        // 在此处可以使用获取到的数据进行相应的操作
        // 例如，更新UI显示或执行其他逻辑

        // 示例：显示姓名和日期数据
        TextView textViewName = findViewById(R.id.textViewName);
        textViewName.setText("您好：" + name);

        TextView textViewDate = findViewById(R.id.textViewDate);
        textViewDate.setText("您的出生日期为：" + year + "年" + (month + 1) + "月" + day+"日");


        ImageView imgViewSrc = findViewById(R.id.imgViewSrc);
        TextView textViewDetails = findViewById(R.id.textViewDetails);

        if ((month == 2 && day >= 21) || (month == 3 && day <= 19)) {
            imgViewSrc.setImageResource(R.drawable.baiyang);
            textViewDetails.setText(getString(R.string.白羊座));
        } else if ((month == 3 && day >= 20) || (month == 4 && day <= 19)) {
            imgViewSrc.setImageResource(R.drawable.jinniu);
            textViewDetails.setText(getString(R.string.金牛座));
        } else if ((month == 4 && day >= 20) || (month == 5 && day <= 20)) {
            imgViewSrc.setImageResource(R.drawable.shizi);
            textViewDetails.setText(getString(R.string.双子座));
        } else if ((month == 5 && day >= 21) || (month == 6 && day <= 21)) {
            imgViewSrc.setImageResource(R.drawable.juxie);
            textViewDetails.setText(getString(R.string.巨蟹座));
        } else if ((month == 6 && day >= 22) || (month == 7 && day <= 22)) {
            imgViewSrc.setImageResource(R.drawable.shizi);
            textViewDetails.setText(getString(R.string.狮子座));
        } else if ((month == 7 && day >= 23) || (month == 8 && day <= 22)) {
            imgViewSrc.setImageResource(R.drawable.chunv);
            textViewDetails.setText(getString(R.string.处女座));
        } else if ((month == 8 && day >= 23) || (month == 9 && day <= 22)) {
            imgViewSrc.setImageResource(R.drawable.tiancheng);
            textViewDetails.setText(getString(R.string.天秤座));
        } else if ((month == 9 && day >= 23) || (month == 10 && day <= 23)) {
            imgViewSrc.setImageResource(R.drawable.tianxie);
            textViewDetails.setText(getString(R.string.天蝎座));
        } else if ((month == 10 && day >= 24) || (month == 11 && day <= 22)) {
            imgViewSrc.setImageResource(R.drawable.sheshou);
            textViewDetails.setText(getString(R.string.射手座));
        } else if ((month == 11 && day >= 23) || (month == 0 && day <= 21)) {
            imgViewSrc.setImageResource(R.drawable.mojie);
            textViewDetails.setText(getString(R.string.摩羯座));
        } else if ((month == 0 && day >= 22) || (month == 1 && day <= 19)) {
            imgViewSrc.setImageResource(R.drawable.shuiping);
            textViewDetails.setText(getString(R.string.水瓶座));
        } else if ((month == 1 && day >= 20) || (month == 2 && day <= 18)) {
            imgViewSrc.setImageResource(R.drawable.shuangyu);
            textViewDetails.setText(getString(R.string.双鱼座));
        } else {
            // 默认情况
            imgViewSrc.setImageResource(R.drawable.shuiping);
            textViewDetails.setText(getString(R.string.水瓶座));
        }
    }
}